package com.demo3;

import com.demo3.component.BeanLifeComponent;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App3 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");

        //获取Bean
        BeanLifeComponent beanLifeComponent =
                context.getBean("beanLifeComponent", BeanLifeComponent.class);
        //使用Bean
        beanLifeComponent.useBean();
        //销毁Bean
        context.destroy();
    }
}
